package com.sec.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sec.mapper.TestMapper;
import com.sec.pojo.Test;

@Service(value="TestService")
public class TestService {
	
	@Autowired
	private TestMapper testMapper;
	
	
	@Transactional
	public Test insertTest(Test test){
		int length = testMapper.insert(test);
		if (length>0) {
			return test;
		}else {
			//新增失败，抛出异常，让spring进行事物回滚
			throw new RuntimeException();
		}
	}
	
	
}
